DESTDIR=~/httpd/paraforum
SCRIPTSDIR=~/httpd/scripts
MOOTESTDIR=$(DESTDIR)/mootests
JS_SOURCES=TextEdit.js State.js Chat.js Forum.js ParaPara.js Requester.js LinkRoll.js loader.js


.PHONY: install install_dirs

all:
	@echo "Nothing to be done for all"
	@echo "Select another target. Available targets are"
	@echo '"install", "clean" and "package"'

install: install_common install_dirs install_src

install_common: install_mootools



install_dirs:
	-mkdir -p $(DESTDIR)
	-mkdir -p $(DESTDIR)/js

install_src:
	cd src_v2 && find . -type f -a ! -path '*/.svn/*' -a -name '*.php' | xargs -itunfisk cp --parents tunfisk $(DESTDIR)
	cd src_v2 && find . -type f -a ! -path '*/.svn/*' -a -name '*.css' | xargs -itunfisk cp --parents tunfisk $(DESTDIR)
	cd src_v2 && find . -type f -a ! -path '*/.svn/*' -a -name '*.png' | xargs -itunfisk cp --parents tunfisk $(DESTDIR)
	cd src_v2 && find . -type f -a ! -path '*/.svn/*' -a -name '*.jpg' | xargs -itunfisk cp --parents tunfisk $(DESTDIR)
	cd src_v2 && find . -type f -a ! -path '*/.svn/*' -a -name '*.gif' | xargs -itunfisk cp --parents tunfisk $(DESTDIR)
	cd src_v2/js && cat $(JS_SOURCES) > $(DESTDIR)/js/paraforum.js

install_mootools:
	-mkdir $(SCRIPTSDIR)
	cd vendors/mootools && cat mootools-1.2-core.js  mootools-1.2-more.js > $(SCRIPTSDIR)/mootools.js


clean:
	-cd $(DESTDIR) && rm -rf *


package:
	echo "Nothing here yet"

linecount:
	@cd src_v2 && echo "Source linecount:" `find . -name '*.php' -o -name '*.js' -o -name '*.css' | xargs cat | wc -l`
